<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="dlgCliente"
                  header="Cliente"
                  widgetVar="dialogCliente" 
                  modal="true" 
                  resizable="false" 
                  appendTo="@(body)" >

            <h:form id="formCliente" >

                <h:panelGrid >

                    <h:panelGroup>

                        <h:outputText value="Nome" /><br/>
                        <p:inputText value="#{clienteBean.selected.nome}" 
                                     style="width: 250px; text-transform: uppercase"
                                     required="true"
                                     requiredMessage="Campo nome requerido"
                                     /><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="CPF" /><br/>
                        <p:inputMask  value="#{clienteBean.selected.cpf}"
                                      style="width: 250px; text-transform: uppercase"
                                      required="true"
                                      requiredMessage="Campo cpf requerido"
                                      mask="999.999.999-99"
                                      /><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Telefone" /><br/>
                        <p:inputMask value="#{clienteBean.selected.telefone}" 
                                     style="width: 250px; text-transform: uppercase"
                                     required="true"
                                     requiredMessage="Campo cpf requerido"
                                     mask="(99)9999-9999"
                                     /><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Endereço" /><br/>
                        <p:inputText value="#{clienteBean.selected.endereco}" 
                                     style="width: 250px; text-transform: uppercase"
                                     required="true"
                                     requiredMessage="Campo cpf requerido"
                                     /><br/>

                    </h:panelGroup>

                </h:panelGrid>


                <hr/>

                <p:commandButton value="Gravar" 
                                 actionListener="#{clienteBean.save(event)}" 
                                 oncomplete="dialogCliente.hide()" 
                                 update=":formOperacaoNegocial:completeCliente" >
                
                    <p:ajax event="click" listener="#{operacaoNegocialBean.resetClientes()}" />
                    
                </p:commandButton>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>


